class Solution {
public:
    bool findTargetIn2DPlants(vector<vector<int>>& plants, int target) {
        if(plants.size()<1 || plants[0].size()<1) 
           return false;
        int x=0,y=plants[0].size()-1;
        while(x < plants.size() && y >=0)
        {
            if(plants[x][y]>target)
            {
                y--;
            }
            else if(plants[x][y]<target)
            {
                x++;
            }
            else
            {
                return true;
            }
        }
        return false;
    }
};